package com.fwtai.web;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 商品优惠券访问数据库
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2024-01-04 18:08:42
 * @QQ号码 444141300
 * @Email service@fwtai.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class CouponDao{

  private final DaoHandle dao;

  public CouponDao(final DaoHandle dao){
    this.dao = dao;
  }

  public int add(final ArrayList<HashMap<String,Object>> list){
    return dao.execute("coupon.add",list);
  }

  public List<HashMap<String,Object>> queryById(final long kid){
    return dao.queryForListHashMap("coupon.queryById",kid);
  }

  public List<HashMap<String,Object>> getListData(final PageFormData formData){
    return dao.queryForListHashMap("coupon.listData",formData);
  }

  public Integer getListTotal(final PageFormData formData){
    return dao.queryForInteger("coupon.listTotal",formData);
  }

  public List<HashMap<String,Object>> getGoodsArea(final HashMap<String,Long> map){
    return dao.queryForListHashMap("coupon.getGoodsArea",map);
  }

  public Integer getGoodsCoupon(final Long kid){
    return dao.queryForInteger("coupon.getGoodsCoupon",kid);
  }

  public int delCoupon(final HashMap<String,Object> map){
    return dao.execute("coupon.delCoupon",map);
  }
}